package com.poker.repository;

import com.poker.entity.News;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface NewsRepository extends JpaRepository<News, String>, JpaSpecificationExecutor<News> {

    @Modifying
    @Query(value = "update News set isTop = false where id not in (?1) and newsType = ?2")
    void updateIsTop(String id, String newsType);

}
